<template>
<div class="layout-app">
	<!-- 悬浮按钮 -->
	<div v-if="isMinimized" class="minimized-button" @click="restoreDialog">
	  <i class="el-icon-message"></i>
	</div>
	<!-- main -->
	<!-- 新增 -->
	<div class="addAcc" ref='myBox' v-if="!isMinimized">
		<el-dialog :title="dialogTitle" v-loading="loading"
		element-loading-text="..."
		element-loading-spinner="el-icon-loading"
		element-loading-background="rgba(141, 141, 141, 0.8)"
		:visible.sync="addDialogVisible" width="58%" v-dialogDrag
		:before-close="handleClose" custom-class="minimizable-dialog" :modal="false">
		<!-- tabs -->
		<div class="tabs">
			<div class="tabsMain">
				<!-- 表单 header -->
				<div class="headerForm">
					<el-form ref="addForm" :rules="addFormRules" :model="addForm" label-width="70px" size="mini">
						<el-row :gutter="8">
							<el-col :xs="val.xs" :sm="val.xs" :md="val.md" :lg="val.lg" :xl="val.xl" type="flex" v-for="(val,i) in formType" :key="i">
								<!-- input -->
								<el-form-item v-if="val.type == 'input'" :label="val.label" :prop="val.modelValue">
									<el-input :suffix-icon='val.prefix' v-model="$data.addForm[val.modelValue]" :placeholder="val.placeholder" :disabled="val.disabled" ></el-input>
								</el-form-item>
								<!-- textarea -->
								<el-form-item v-if="val.type == 'textarea'" :label="val.label" :prop="val.modelValue">
									<el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="$data.addForm[val.modelValue]"></el-input>
								</el-form-item>
								<!-- select -->
								<el-form-item v-if="val.type == 'select'" :label="val.label" :prop="val.modelValue">
									<el-select v-model="$data.addForm[val.modelValue]" filterable placeholder="请选择" @focus="sname(val,i)"
									@change="handleChange" :disabled="val.disabled">
										<el-option v-for="item in $data[val.op]" :key="item.id" :label="item.label" :value="item.id"> 
										<span style="color: #8492a6; font-size: 12px">{{ item.label }}</span></el-option>
									</el-select>
								</el-form-item>
								<!-- date -->
								<el-form-item v-if="val.type == 'date'" :label="val.label" :prop="val.modelValue">
									<el-date-picker
									:picker-options="pickerOptions" :disabled="val.disabled ? true : false"
									type="date" value-format="yyyy-MM-dd" placeholder="选择日期" v-model="$data.addForm[val.modelValue]">
									</el-date-picker>
								</el-form-item>
								<!-- btn -->
								<el-form-item v-if="val.type == 'btn'">
									<el-button type="primary" plain @click="clickEvents(val,i)">{{ val.label }}</el-button>
								</el-form-item>
							</el-col>
						</el-row>
					</el-form>
				</div>
				<!-- 表单数据！第二层取addForm下的list -->
				<div class="mainForm">
					<el-form ref="addMainForm" :rules="addMainFormRules" :model="addMainForm" label-width="88px" size="mini">
						<el-row :gutter="8">
							<el-col :xs="val.xs" :sm="val.xs" :md="val.md" :lg="val.lg" :xl="val.xl" type="flex" v-for="(val,i) in formMainType" :key="i">
								<!-- input -->
								<el-form-item v-if="val.type == 'input'" :label="val.label" :prop="val.modelValue">
									<el-input :suffix-icon='val.prefix' v-model="$data.addMainForm[val.modelValue]" :disabled="val.disabled" ></el-input>
								</el-form-item>
								<!-- input 数量 -->
								<el-form-item v-if="val.type == 'inputNum'" :label="val.label + unt" :prop="val.modelValue">
									<el-input :suffix-icon='val.prefix' v-model="$data.addMainForm[val.modelValue]" @blur="handleInput(val,i)" :disabled="val.disabled" ></el-input>
								</el-form-item>
								<!-- textarea -->
								<el-form-item v-if="val.type == 'textarea'" :label="val.label" :prop="val.modelValue">
									<el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="$data.addMainForm[val.modelValue]"></el-input>
								</el-form-item>
								<!-- select -->
								<el-form-item v-if="val.type == 'select'" :label="val.label" :prop="val.modelValue">
									<el-select v-model="$data.addMainForm[val.modelValue]" filterable placeholder="请选择" @focus="foucsSelect(val,i)"
									@change="handleMainFormChange" :disabled="val.disabled">
										<el-option v-for="item in $data[val.op]" :key="item.id" :label="item.label" :value="item.id"> 
										<span style="font-size: 12px">{{ item.label }}</span></el-option>
									</el-select>
								</el-form-item>
								<!-- btn -->
								<el-form-item v-if="val.type == 'tag'" style="margin-left: -78px;">
									<el-tag size="medium">{{ MarkUp }}</el-tag>
								</el-form-item>
								<!-- date -->
								<el-form-item v-if="val.type == 'date'" :label="val.label" :prop="val.modelValue">
									<el-date-picker class="autoWidth" :picker-options="pickerOptions" @focus="dateChoose(i)"
									type="date" value-format="yyyy-MM-dd" placeholder="选择日期" v-model="$data.addMainForm[val.modelValue]">
									</el-date-picker>
								</el-form-item>
								<!-- btn -->
								<el-form-item v-if="val.type == 'btn'">
									<el-button type="primary" plain @click="clickEvents(val,i)">{{ val.label }}</el-button>
								</el-form-item>
							</el-col>
						</el-row>
					</el-form>
				</div>
				<!-- table -->
				<div class="table">
					<el-table :data="tableData" border 
					:style="{ width: tableWidth + 'px' }"
					:cell-class-name="tableCellClassName">
						<!-- 字段映射 -->
						<el-table-column prop="drugName" label="药品名称" align='center' width="128"></el-table-column>
						<el-table-column prop="purcPric" label="成本单价" align='center'></el-table-column>
						<el-table-column prop="salePric" label="零售单价" align='center'></el-table-column>
						<el-table-column prop="purcAmt" label="成本金额" align='center'></el-table-column>
						<el-table-column prop="saleAmt" label="零售金额" align='center'></el-table-column>
						<!-- 在el-table-column中添加生产厂家可编辑列 -->
						<el-table-column prop="purcCnt" label="入库数量">
						  <template slot-scope="scope">
						    <el-input size="mini"
						      v-if="scope.row.editing"
						      v-model.number="scope.row.purcCnt"
						      @input="handleInputChange(scope.row)"
						      placeholder="请输入"/>
						    <span v-else>{{ scope.row.purcCnt }}</span>
						  </template>
						</el-table-column>
						<el-table-column prop="manuLotnum" label="生产批号">
						  <template slot-scope="scope">
						    <el-input size="mini"
						      v-if="scope.row.editing"
						      v-model="scope.row.manuLotnum"
						      @input="handleInputChange(scope.row)"
						      placeholder="请输入"/>
						    <span v-else>{{ scope.row.manuLotnum }}</span>
						  </template>
						</el-table-column>
						<el-table-column prop="minPurcPric" label="成本单价【小单位】" width="168px">
						  <template slot-scope="scope">
							<el-input size="mini"
							  v-if="scope.row.editing"
							  v-model="scope.row.minPurcPric"
							  @change="handleInputChange(scope.row)"
							  placeholder="请输入"/>
						    <span v-else>{{ scope.row.minPurcPric }}</span>
						  </template>
						</el-table-column>
						<el-table-column prop="minSalePric" label="零售单价【小单位】" width="168px">
						  <template slot-scope="scope">
							<el-input size="mini"
							  v-if="scope.row.editing"
							  v-model="scope.row.minSalePric"
							  @change="handleInputChange(scope.row)"
							  placeholder="请输入"/>
						    <span v-else>{{ scope.row.minSalePric }}</span>
						  </template>
						</el-table-column>
						<el-table-column prop="manuDate" label="生产日期" width="168px">
						  <template slot-scope="scope">
							  <el-date-picker
								v-if="scope.row.editing" :picker-options="manuDatePickerOptions"
								v-model="scope.row.manuDate" type="date" value-format="yyyy-MM-dd" size="mini"
								@change="handleInputChange(scope.row)">
							  </el-date-picker>
						    <span v-else>{{ scope.row.manuDate }}</span>
						  </template>
						</el-table-column>
						<el-table-column prop="expyDate" label="有效日期" width="168px">
						  <template slot-scope="scope">
							  <el-date-picker
								v-if="scope.row.editing" :picker-options="expyDatePickerOptions"
								v-model="scope.row.expyDate" type="date" value-format="yyyy-MM-dd" size="mini"
								@change="handleInputChange(scope.row)">
							  </el-date-picker>
						    <span v-else>{{ scope.row.expyDate }}</span>
						  </template>
						</el-table-column>
						
						<!-- 循环列 -->
						<el-table-column v-for="(col, inx) in tableRows" :key="inx" :type="col.type" :prop="col.prop" :label="col.name" :width="columnWidth(col, tableData)"></el-table-column>
						<el-table-column prop="markUpType" label="加成方式">
							 <template slot-scope="{ row }">
								<!-- 根据加成方式显示不同的title -->
								<span>{{ addWaysMap[row.markUpId] || 'UNDEFIND' }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="putinTypeId" label="入库方式">
							 <template slot-scope="{ row }">
								<!-- 根据加成方式显示不同的title -->
								<span>{{ inStroeMap[row.putinTypeId] || 'UNDEFIND' }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="purcType" label="库存类型">
							 <template slot-scope="{ row }">
								<!-- 根据加成方式显示不同的title -->
								<span>{{ StroeKindsMap[row.purcType] || 'UNDEFIND' }}</span>
							</template>
						</el-table-column>
						<!-- fixed -->
						<el-table-column fixed="left" label="行号" type="index" width="68" align="center"></el-table-column>
						<!-- edit -->
						<el-table-column fixed="right" label="操作" width="148">
							<template slot-scope="scope">
								<div class="editbox" style="text-align: center;">
									<template v-if="!scope.row.editing">
										<el-button type="primary" @click="enableEditing(scope.row)" size="mini">编辑</el-button>
										<el-button type="danger" @click.native.prevent="deleteRow(scope.$index, tableData)" size="mini">删除</el-button>
									</template>
									<template v-else>
										<el-button type="success" @click="saveEdit(scope.row)" size="mini">完成</el-button>
										<el-button type="info" @click="cancelEdit(scope.row)" size="mini">取消</el-button>
									</template>
								</div>
							</template>
						</el-table-column>
					</el-table>
					<div class="total">
						<span>原零售：</span><el-input v-model="cbValue" style="width: 88px;" size="mini" :disabled='totaldisabled'></el-input>
						<span style="margin-left: 12px;">现零售：</span><el-input v-model="lsValue" style="width: 88px;" size="mini" :disabled='totaldisabled'></el-input>
						<span style="margin-left: 12px;">盈亏金：</span><el-input v-model="lsValue" style="width: 88px;" size="mini" :disabled='totaldisabled'></el-input>
						<span style="margin-left: 12px;">原成本：</span><el-input v-model="lsValue" style="width: 88px;" size="mini" :disabled='totaldisabled'></el-input>
						<span style="margin-left: 12px;">现成本：</span><el-input v-model="lsValue" style="width: 88px;" size="mini" :disabled='totaldisabled'></el-input>
						<span style="margin-left: 12px;">盈亏金：</span><el-input v-model="lsValue" style="width: 88px;" size="mini" :disabled='totaldisabled'></el-input>
					</div>
				</div>
			</div>
		</div>
		<!-- 新增提交 -->
		<div slot="footer" class="dialog-footer" v-if="!isEditShow">
			<el-button size="mini" type="info" plain @click="draftSubmit">存为草稿</el-button>
			<el-button size="mini" type="primary" plain @click="addSubmit">保存提交</el-button>
			<el-button size="mini" plain @click="minimizeDialog">最小化</el-button>
		</div>
		<!-- 编辑提交 -->
		<div slot="footer" class="dialog-footer" v-if="isEditShow">
			<el-button size="mini" type="info" plain @click="draftEditSubmit">修改保存草稿</el-button>
			<el-button size="mini" type="primary" plain @click="editSubmit">修改提交</el-button>
			<el-button size="mini" plain @click="minimizeDialog">最小化</el-button>
		</div>
	</el-dialog>
	</div>
	<!-- 内层Model -->
	<div class="innerModel">
		
	</div>

</div>
</template>

<script>
// self
import AccType from './AddRukuType.js'
import AccMainType from './AddRukuTypeMain.js'
import addForm from './addForm.js' //Form表单
// prop

// ext
import { getLunar } from 'chinese-lunar-calendar'

// 接口
// import { 
// 	getPurchasingPlan,toExamineTcm,getPlans,selectDropDownList,getWare,
// 	getDrugDetails,getManufacturer,getDocMark,
// 	addDrugStorage
//  } from "@/api/systemCatalogue/traMedici.js";
 
 import {
 	addDrugStorage,editPurchase,getPurchasingPlan,getPlans,getPlanDrugDetails,
 	getWare,selectDropDownList,selectInformation,getDocMark,getDrugDetails
 	} from "@/api/PSI.js";
export default {
	props: ['parentMethod'],
	components:{
		
	},
	data(){
		return{
			//str
			tableWidth:'', //右侧表格动态宽度
			value:'',
			dialogTitle:'新增西药库零售调价单',
			unt:'', // 单位 （数量：盒？包？g?）
			inputSearchValue:'',
			deptCode:'',
			userId:'', // 制单人Id,取当然操登录用户I的.用于后端不反的情况下使用
			getLunarDay: '',
			areaCode:'',
			areaPName:'',
			appId:'', // * 选择采购计划时的Id
			startDate:'', // * 开始时间
			endDate:'', // * 结束时间
			idx:'',
			cbValue:'', // 成本合计
			lsValue:'', // 零售合计
			currentCell: null, // 单元格隐藏
			year: new Date().getFullYear(),
			month: new Date().getMonth() + 1,
			date: new Date().getDate(),
			lunarDate: '',//农历
			// 1 - 3
			firstName:'',
			seconedName:'',
			thirdName:'',
			auditStatus:'5',
			currentRow: null, //单选高亮
			//num
			MarkUp:0, // 加成率
			pacValue:0, // 换算关系
			pageNum: 1, //当前页currentPage
			pageSize: 6,
			totalSize: 10, //总条数
			//ble
			loading:false,
			disabled:true,
			totaldisabled:true,
			isMinimized: false,
			addghdwDialog:false,
			isEditShow:false,
			addDialogVisible: false, //新增采购入库model
			dialogFormVisible:false,
			innerVisible:false, //内层Model选择采购计划
			//arr
			formType:[], // 表单头部内容
			formMainType:[], // 表单主体内容
			tableData:[],
			tableRows:[
				{ name:"规格描述", prop:"drugSpec", type:"" },{ name:"生产厂家", prop:"prodentpName", type:"" },
			],
			innertableData:[], //内层采购计划数据源
			currentObj:{}, //内层采购计划数据源 = > 单击选择
			currentTable: [],//表格单选
			innertableDataRows:[
				{ name:"单据编号", prop:"docNum"},{ name:"业务日期", prop:"busDate" },
				{ name:"申请科室", prop:"prodentpNameId"},{ name:"供货单位", prop:"supplierName" },
				{ name:"合计金额", prop:"totalAmt" },{ name:"制单人", prop:"reviewName"},{ name:"制单时间", prop:"reviewTime"},
				{ name:"审核人", prop:"passingOrdersName" },{ name:"审核时间", prop:"passingOrdersTime" }
			],
			selectOption:[{id:1,label:'西药库',value:'西药库'}],//库房
			ghdwOption:[
				{id:1,label:'水富市人民医院',value:'水富市人民医院'},{id:2,label:'昆明灵泽科技有限公司',value:'昆明灵泽科技有限公司'},
			],
			cgOption:[
				{id:1,label:'集中采购',value:'集中采购'},{id:2,label:'谈判药品',value:'谈判药品'},{id:3,label:'带量采购',value:'带量采购'},
				{id:4,label:'备案采购',value:'备案采购'},{id:5,label:'非平台采购',value:'非平台采购'},{id:6,label:'精麻药品',value:'精麻药品'},
				{id:7,label:'直接采购-国产非中选',value:'直接采购-国产非中选'},{id:8,label:'省际联盟带量采购',value:'省际联盟带量采购'},
				{id:9,label:'国家带量采购',value:'国家带量采购'},{id:10,label:'省级带量采购',value:'省级带量采购'}
			],
			// 表单验证规则 header
			addFormRules:{
				shedId: [{ required: true, message: '请先选择要入库的库房！', trigger: 'change' }],
				supplyCandidateId: [{ required: true, message: '请选择供货单位！', trigger: 'change' }],
				// 示例：号码验证
				purcInvoCodg: [
				    { required: false, message: '请输入发票号！', trigger: 'blur' },
				    { 
				      pattern: /^\w+$/,  // 正则验证
				      message: '可输入：字母/数字/下划线',
				      trigger: 'blur'
				    }
				],
				supplyCode: [
				    { required: false, message: '请输入供货号！', trigger: 'blur' },
				    { 
				      pattern: /^\w+$/,  // 正则验证
				      message: '可输入：字母/数字/下划线',
				      trigger: 'blur'
				    }
				],
			},
			// 表单验证规则 main
			addMainFormRules:{
				drugId: [{ required: true, message: '请先选择药品信息！', trigger: 'change' }],
				manuDate: [{ required: true, message: '请选择药品的生产日期', trigger: 'change' }],
				expyDate: [{ required: true, message: '请选择药品的有效日期', trigger: 'change' }],
				purcType: [{ required: true, message: '请先选择库存类型！', trigger: 'change' }],
				manuLotnum: [
					{ required: true, message: '请输入药品的生产批号！', trigger: 'blur' },
					{ 
					  pattern: /^\w+$/,  // 正则验证
					  message: '格式错误！(字母/数字)',
					  trigger: 'blur'
					}
				],
				purcCnt: [
					{ required: true, message: '入库的数量为必填项！', trigger: 'blur' },
					{ 
					  pattern: /^[1-9][0-9]*$/,  // 正则验证
					  message: '入库的数量为非0正整数!',
					  trigger: 'blur'
					}
				],
			},
			addWaysMap: {
				1: '不加成',
				2: '固定加成',
				3: '比例加成',
				4: '手工比例加成',
			},
			inStroeMap:{
				1: '采购入库',
				2: '其他入库',
				3: '赠送入库',
				4: '盘点单位',
				5: '系统切换入库',
			},
			// 库存类型
			StroeKindsMap:{
				1: '最小单位',
				2: '包装单位',
			},
			// 单据状态 0 草稿,1 回退提交,2 已提交,3 回退审核,4 已审核,5 已过单,6 已作废'
			statusOption:[
				{id:0,label:'草稿'},{id:1,label:'回退提交'},{id:2,label:'已提交'},{id:3,label:'回退审核'},{id:4,label:'已审核'},{id:5,label:'已过单'},{id:6,label:'已作废'},
			],
			sexOptions:[{id:1,label:'男',value:'男'},{id:2,label:'女',value:'女'}],
			marryiedOptions:[{id:1,label:'未婚',value:'未婚'},{id:2,label:'已婚',value:'已婚'},{id:3,label:'离异',value:'离异'},{id:4,label:'丧偶',value:'丧偶'},{id:5,label:'再婚',value:'再婚'}],
			nameOption:[],
			
			//obj
			addForm:{}, // form表单 * 
			addMainForm:{}, // form主体表单 * addForm.list
			oldData:{},
			lists:{},
			options:[],
			kcOptions:[{id:1,label:'最小单位',value:'最小单位'},{id:2,label:'包装单位',value:'包装单位'}], // 库存类型
			 // 入库方式
			rkWaysOptions:[
				{id:1,label:'采购入库',value:'采购入库'},{id:2,label:'其他入库',value:'其他入库'},
				{id:3,label:'赠送入库',value:'赠送入库'},{id:4,label:'盘点单位',value:'盘点单位'},{id:5,label:'系统切换入库',value:'系统切换入库'}
			],
			// 加成方式
			MarkOption:[
				{ id:1,label:'不加成',value:'不加成'},{ id:2,label:'固定加成',value:'固定加成'},
				{ id:3,label:'比例加成',value:'比例加成'},{ id:4,label:'手工比例加成',value:'手工比例加成'}
			],
			ssrOption:[],
			gysOption:[],
			ManufacturerOptions:[],
			//props
			pickerOptions: {},
			manuDatePickerOptions: {
				disabledDate(time) { return time.getTime() > Date.now() },
				shortcuts: [
					{ text: '今天', onClick(picker) { picker.$emit('pick', new Date()); }}, 
					{ text: '昨天', onClick(picker) { const date = new Date();date.setTime(date.getTime() - 3600 * 1000 * 24);picker.$emit('pick', date);}}, 
					{ text: '一周前',onClick(picker) {const date = new Date();date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);picker.$emit('pick', date);}},
					{ text: '最近一个月',onClick(picker) {const date = new Date();date.setTime(date.getTime() - 3600 * 1000 * 24 * 30);picker.$emit('pick', date);}},
					{ text: '最近三个月',onClick(picker) {const date = new Date();date.setTime(date.getTime() - 3600 * 1000 * 24 * 90);picker.$emit('pick', date);}},
					{ text: '半年前',onClick(picker) {const date = new Date();date.setTime(date.getTime() - 3600 * 1000 * 24 * 180);picker.$emit('pick', date);}},
					{ text: '去年',onClick(picker) {const date = new Date();date.setTime(date.getTime() - 3600 * 1000 * 24 * 360);picker.$emit('pick', date);}},
				]
			},
			expyDatePickerOptions: {
				disabledDate(time) { return time.getTime() < Date.now() },
				shortcuts: [
					{ text: '三个月后',onClick(picker) {const date = new Date();date.setTime(date.getTime() + 3600 * 1000 * 24 * 90);picker.$emit('pick', date);}},
					{ text: '半年后',onClick(picker) {const date = new Date();date.setTime(date.getTime() + 3600 * 1000 * 24 * 180);picker.$emit('pick', date);}},
					{ text: '明年',onClick(picker) {const date = new Date();date.setTime(date.getTime() + 3600 * 1000 * 24 * 360);picker.$emit('pick', date);}},
					{ text: '后年',onClick(picker) {const date = new Date();date.setTime(date.getTime() + 3600 * 1000 * 24 * 720);picker.$emit('pick', date);}},
					{ text: '三年后',onClick(picker) {const date = new Date();date.setTime(date.getTime() + 3600 * 1000 * 24 * 360 * 3);picker.$emit('pick', date);}},
					{ text: '五年后',onClick(picker) {const date = new Date();date.setTime(date.getTime() + 3600 * 1000 * 24 * 360 * 5);picker.$emit('pick', date);}},
					{ text: '十年后',onClick(picker) {const date = new Date();date.setTime(date.getTime() + 3600 * 1000 * 24 * 360 * 10);picker.$emit('pick', date);}},
				]
			},
			statusMap: {
				0: '草稿',
				1: '回退提交',
				2: '已提交',
				3: '回退审核',
				4: '已审核',
				5: '已过单',
				6: '已作废'
			},
			statusIconMap: {
				0: 'el-icon-document',
				1: 'el-icon-top-left',
				2: 'el-icon-check',
				3: 'el-icon-bottom-right',
				4: 'el-icon-document-checked',
				5: 'el-icon-success',
				6: 'el-icon-delete'
			},
			statusColorMap: {
				0: '#909399',
				1: '#67C23A',
				2: '#409EFF',
				3: '#E6A23C',
				4: '#409EFF',
				5: '#409EFF',
				6: '#F56C6C'
			},
			
		}
	},
	created() {
		
	},
	mounted() {
		// 获取接口参数
		this.getAddForm();
		// 获取当前日期时间
		this.getNowDateTime();		
		// console.log(this.addForm.busDate);
		this.getGys();
		this.getDrugWare();
	},
	methods:{
		// 采购计划数据
		async loadData(){
			let res = await getPlans({
				pageNum:this.pageNum,
				pageSize:this.pageSize,
				startDate:this.startDate,
				endDate:this.endDate,
			});
			if(res.code == 200){
				this.innertableData = res.data.content
				this.totalSize = res.data.totalSize
			}else{
				this.$message({type: 'error',message: res.message});
			}
		},
		// 将当前日期时间设置为夜晚十一点五十九分
		getNowDateTime(){
			// 获取当前日期时间、
			this.addForm.createTime = new Intl.DateTimeFormat('zh-CN').format(new Date()).replace(/\//g, '-');
			// 赋值业务日期
			this.addForm.busDate = new Intl.DateTimeFormat('zh-CN').format(new Date()).replace(/\//g, '-');
			// 获取终端序号 => 当前登录用户
			this.addForm.terminalId = localStorage.getItem('terminalId');
		},
		// 获取制单人 => 当前登录用户
		getCreateId(){
			this.addForm.createId = JSON.parse(localStorage.getItem('userInfo')).userId;
		},
		async getGys(){
			// 供应商下拉列表
			let rs = await selectDropDownList();
			this.gysOption = rs.data.content.map(obj => {
			  // 将 name 替换为 label，并保留其他字段
			  return { label: obj.supplierName , ...obj };
			});
		},
		async getDrugWare(){
			// 药品数据下拉列表
			let res = await getWare();
			this.nameOption = res.data.content.map(obj => {
			  // 将 name 替换为 label，并保留其他字段
			  return { label: obj.drugName , ...obj };
			});
		},
		// 取消高亮
		setCurrent(row) {
		    this.$refs.singleTable.setCurrentRow(row);
		},
		// 内层选择数据按钮
		chooseData(){
			if(this.currentTable.length === 0){
				this.$message({ type: 'warning', message: '请先选择一条数据!'});
			}else{
				// 先找id对应的数据赋值
				setTimeout(async()=>{
					let res = await getPlanDrugDetails({id:this.appId})
					if(res.code === 200){
						this.currentTable = res.data
						let opidata = this.currentTable.list[0]
						this.pd(opidata);
					} else {
						this.$message({ type: 'warning', message: 'fail!'});
					}
				},888)
			}
		},
		// 判断
    async pd(opidata) {
      this.loading = true;
      try {
        // 判断opidata是否为数组
        if (Array.isArray(opidata)) {
          for (const singleOpidata of opidata) {
            await this.processSingleData(singleOpidata);
          }
        } else {
          await this.processSingleData(opidata);
        }

        this.addForm.shedId = 1; // 默认就是西药库
        this.getCreateId(); // 后端没反就默认当前人为制单人Id
        this.$message.success('已添加所有药品数据！');
      } catch (error) {
        console.error('处理药品数据时出错:', error);
        this.$message.error('添加药品数据时出错');
      } finally {
        this.loading = false;
        this.innerVisible = false;
      }
    },

    // 处理单条数据的方法
    async processSingleData(opidata) {
      if (this.tableData.length === 0) {
        // 直接赋值
        // 根据 NameOptions绑定的id 找到对应的对象 => 依次赋值
        let drugInfos = this.nameOption.find(drugId => drugId.id == opidata.drugId);
        if (drugInfos) {
          // 遍历 opidata 的所有键名
          for (let key in opidata) {
            // 检查键名是否在对象 opidata 中存在
            if (!drugInfos.hasOwnProperty(key)) {
              // 如果存在，将 drugInfos 中的值更新到 opidata 中
              drugInfos[key] = opidata[key];
            }
          }
          // 计算
          if (drugInfos.markUpFixed === 1) {
            // 走固定加成
            drugInfos.salePric = drugInfos.costPric + Number(drugInfos.markUpPric);
            drugInfos.minPurcPric = drugInfos.costPric / drugInfos.convnRelp;
            drugInfos.minSalePric = drugInfos.salePric / drugInfos.convnRelp;
            // 算总金额了 = 单价*数量
            drugInfos.purcAmt = drugInfos.costPric * drugInfos.purcCnt; // 成本总金额
            drugInfos.saleAmt = drugInfos.salePric * drugInfos.purcCnt; // 零售总金额
          } else {
            // 走比例加成 => 获取药品加成率
            let res = await getDocMark({ drugType: 1, pageNum: this.pageNum, pageSize: this.pageSize });
            drugInfos.markUpRate = res.data.content[0].markUpRate;
            drugInfos.salePric = drugInfos.costPric * drugInfos.markUpRate;
            drugInfos.minPurcPric = drugInfos.costPric / drugInfos.convnRelp;
            drugInfos.minSalePric = drugInfos.salePric / drugInfos.convnRelp;
            // 算总金额了 = 单价*数量
            drugInfos.purcAmt = drugInfos.costPric * drugInfos.purcCnt; // 成本总金额
            drugInfos.saleAmt = drugInfos.salePric * drugInfos.purcCnt; // 零售总金额
          }
          console.log(drugInfos, '拿到合并之后换算关系');
          this.tableData.push(drugInfos);
        }
      } else {
        // 先判断过后再追加条件赋值
        let res = this.tableData.some(objA => {
          return opidata.drugId === objA.drugId && opidata.drugName == objA.drugName;
        });
        // 判断新增的药品序号和前一条是否相同
        if (res === true) {
          this.$confirm('检测到单据中已存在相同药品, 是否将其追加合并?', '提示', {
            confirmButtonText: '合并追加',
            cancelButtonText: '重新选择',
            type: 'warning'
          }).then(() => {
            this.loading = true; // 开始添加
            setTimeout(() => {
              // 将tableData下对应的数量取出追加到现有的tableData中，并重新计算总金额
              let found = this.tableData.find(objA => objA.drugId === opidata.drugId && objA.drugName === opidata.drugName);
              if (found) {
                  const index = this.tableData.indexOf(found);
                  const newPurcCnt = Number(found.purcCnt) + Number(opidata.purcCnt);
                  const newPurcAmt = found.costPric * newPurcCnt;
                  const newSaleAmt = found.salePric * newPurcCnt;
              
                  this.$set(this.tableData, index, {
                      ...found,
                      purcCnt: newPurcCnt,
                      purcAmt: newPurcAmt,
                      saleAmt: newSaleAmt,
					  cbValue: newPurcAmt,
					  lsValue: newSaleAmt
                  });
              }
              this.loading = false; // 关闭加载
              // 赋值成功清空当前currentTable
              this.currentTable = [];
              this.getTotalAmt();
            }, 1888);
          }).catch(() => {
            this.$message({ type: 'info', message: '已取消' });
          });
        } else {
          // 根据 NameOptions绑定的id 找到对应的对象 => 依次赋值
          let drugInfos = this.nameOption.find(drugId => drugId.id == opidata.drugId);
          if (drugInfos) {
            // 遍历 opidata 的所有键名
            for (let key in opidata) {
              // 检查键名是否在对象 opidata 中存在
              if (!drugInfos.hasOwnProperty(key)) {
                // 如果存在，将 drugInfos 中的值更新到 opidata 中
                drugInfos[key] = opidata[key];
              }
            }
            // 计算
            if (drugInfos.markUpFixed === 1) {
              // 走固定加成
              drugInfos.salePric = drugInfos.costPric + Number(drugInfos.markUpPric);
              drugInfos.minPurcPric = drugInfos.costPric / drugInfos.convnRelp;
              drugInfos.minSalePric = drugInfos.salePric / drugInfos.convnRelp;
              // 算总金额了 = 单价*数量
              drugInfos.purcAmt = drugInfos.costPric * drugInfos.purcCnt; // 成本总金额
              drugInfos.saleAmt = drugInfos.salePric * drugInfos.purcCnt; // 零售总金额
            } else {
              // 走比例加成 => 获取药品加成率
              let res = await getDocMark({ drugType: 1, pageNum: this.pageNum, pageSize: this.pageSize });
              drugInfos.markUpRate = res.data.content[0].markUpRate;
              drugInfos.salePric = drugInfos.costPric * drugInfos.markUpRate;
              drugInfos.minPurcPric = drugInfos.costPric / drugInfos.convnRelp;
              drugInfos.minSalePric = drugInfos.salePric / drugInfos.convnRelp;
              // 算总金额了 = 单价*数量
              drugInfos.purcAmt = drugInfos.costPric * drugInfos.purcCnt; // 成本总金额
              drugInfos.saleAmt = drugInfos.salePric * drugInfos.purcCnt; // 零售总金额
            }
            console.log(drugInfos, '拿到合并之后换算关系');
            this.tableData.push(drugInfos);
          }
        }
      }
    },
		
		// 表单主体聚焦事件 => addMainForm
		async foucsSelect(v,i){
			// val.id = i;
			this.idx = i;
			switch (i) {
				case 0:
				this.getDrugWare();
				break;
			}
		},
		handleInput(v,i){
			this.idx = i;
			// i event
			switch (i) {
				case 9:
					this.getTotalAmt();
				break;
			}
		},
		sname(v,i){
			switch(i){
				case 5:
					this.getGys();
				break;
			}
		},
		// 表单主体Select选择事件 => 赋值
		handleMainFormChange(val){
			// console.log(val,this.idx);
			// i event
			switch (this.idx) {
				// 药品
				case 0:{
					// 根据 NameOptions绑定的id 找到对应的对象 => 依次赋值
					let drugInfos = this.nameOption.find(drugId => drugId.id === val)
					this.addMainForm.drugId = drugInfos.id // 药品id
					this.addMainForm.drugSpec = drugInfos.drugSpecifications // 药品规格
					this.addMainForm.drugName = drugInfos.drugName // 药品名称
					this.addMainForm.pacName = drugInfos.pacName // 药品单位
					this.addMainForm.prodentpNameId = drugInfos.manufacturerId // 生产厂家id
					this.addMainForm.prodentpName = drugInfos.manufacturerName // 生产厂家Name
					this.addMainForm.approvalNumber = drugInfos.approvalNumber  // 批准文号
					this.addMainForm.markUpId = drugInfos.markUpId // 加成方式
					this.addMainForm.putinTypeId = this.addForm.putinTypeId // 入库方式
					this.unt =this.addMainForm.pacUnt = drugInfos.pacUnt // 包装单位
					this.addMainForm.purcPric = Number(drugInfos.costPric) // 成本单价
					/* 根据是否固定加成完成对大小单位  */
					if(drugInfos.markUpFixed === 1 && drugInfos.markUpPric != ''){
						// 走固定加成
						this.getMarkPrice(drugInfos);
					}else{
						// 走比例加成
						this.getMarkUp(drugInfos);
					}
				}
				break;
			}
		},
		// 获取药品加成率
		async getMarkUp(drugInfos){
			let res = await getDocMark({
				drugType: 1,
				pageNum: this.pageNum,
				pageSize: this.pageSize
			});
			this.MarkUp = res.data.content[0].markUpRate
			this.addMainForm.markUpId = res.data.content[0].markUpType
			this.addMainForm.minPurcPric = this.addMainForm.purcPric / drugInfos.convnRelp // 最小单位成本单价
			this.addMainForm.salePric = (this.MarkUp * this.addMainForm.purcPric).toFixed(2); // 余数四舍五入取最后两位
			this.addMainForm.minSalePric = this.addMainForm.salePric / drugInfos.convnRelp // 最小单位销售单价
		},
		// 走固定加成
		async getMarkPrice(drugInfos){
			this.MarkUp = drugInfos.markUpPric;
			this.addMainForm.purcPric = drugInfos.costPric
			this.addMainForm.minPurcPric = drugInfos.costPric / drugInfos.convnRelp; // 最小单位成本单价
			this.addMainForm.salePric = Number(drugInfos.markUpPric) + drugInfos.costPric;
			this.addMainForm.minSalePric = this.addMainForm.salePric / drugInfos.convnRelp; // 最小单位销售单价
		},
		// 计算总成本和零售合计
		getTotalAmt() {
			let cbTotal = 0;
			let lsTotal = 0;
			this.tableData.forEach(row => {
				cbTotal += row.purcAmt;
				lsTotal += row.saleAmt;
			});
			this.cbValue = cbTotal;
			this.lsValue = lsTotal;
		},
		// 循环加入按钮点击事件
		clickEvents(val,i){
			this.idx = i;
			switch (i) {
				case 16:
				//触发验证表单
				this.$refs.addMainForm.validate(async(valid) => {
				if(valid){
					if(this.tableData.length == 0){
						console.log(this.addMainForm);
						this.tableData.push(JSON.parse(JSON.stringify(this.addMainForm)));
						this.$refs['addMainForm'].resetFields();
					}else{
						// 判断是否新增的药品序号和前一条相同
						let res = this.tableData.some(i => i.drugId === this.addMainForm.drugId && i.id === this.addMainForm.id)
						// 重复数据
						if(res === true){
							this.$message.error('表格中已存在相同药品：' + this.addMainForm.drugName + '，请勿重复添加！')
						}else{
							this.$message.success('已添加！')
							this.tableData.push(JSON.parse(JSON.stringify(this.addMainForm)));
						}
					}
					}
				})
				break;
			}
		},
		// 启用编辑状态
		enableEditing(row) {
		  // 确保整个对象是响应式的
		  const reactiveRow = this.$set(this.tableData, this.tableData.indexOf(row), {
		    ...row,
		    editing: true,
		    originalData: { ...row } // 保存原始数据
		  });
		  this.oldData = reactiveRow;
		  console.log(this.oldData, 'oladuygasgoi');
		},
		
		// 保存编辑
		saveEdit(row) {
		  this.loading = true;
		  setTimeout(() => {
		    // 禁用编辑状态
		    this.$set(row, 'editing', false);
		    // 重新计算总金额
		    row.purcAmt = row.costPric * row.purcCnt;
		    row.saleAmt = row.salePric * row.purcCnt;
		    this.getTotalAmt();
		    // 更新表格数据
		    this.tableData = this.tableData.map(item => 
		      item.drugId === row.drugId ? row : item
		    );
		    this.$refs['addMainForm']?.resetFields();
		    this.loading = false;
		  }, 800); // 减少延迟时间
		},
		
		// 取消编辑
		cancelEdit(row) {
		  // 恢复原始数据
		  Object.assign(row, row.originalData);
		  this.$set(row, 'editing', false);
		  delete row.originalData;
		},
		
		// 处理输入变化
		handleInputChange(row) {
		  // 重新计算总金额
		  this.addForm.costAmt = row.purcAmt = row.purcPric * row.purcCnt;
		  this.addForm.saleAmt = row.saleAmt = row.salePric * row.purcCnt;
		  this.getTotalAmt();
		},
		//新增保存
		async addSubmit(){
			//触发验证表单
			this.$refs.addForm.validate(async(valid) => {
			if(valid){
			this.addForm.state = 2
			this.addForm.list = this.tableData
				if(this.tableData.length === 0){
					this.$message({type: 'error',message: '暂无对应的单据明细...' });
				}else{
					console.log(this.addForm);
					let result = await addDrugStorage(this.addForm)
					if (result.code === 200) {
					this.$message({ type: 'success', message: '入库成功！' });
					this.parentMethod(); // 更新数据驱动 => 父组件 shopPlan
					this.addDialogVisible = false;
					} else {
					this.$message.error(result.message)
					}
				}
			}
			})
		},
		// 草稿保存
		async draftSubmit(){
			//触发验证表单
			this.$refs.addForm.validate(async(valid) => {
			if(valid){
			this.addForm.state = 0
			this.addForm.list = this.tableData
			console.log(this.addForm);
			let result = await addDrugStorage(this.addForm)
				if (result.code === 200) {
					this.$message({ type: 'success', message: '采购计划草稿：已保存！！' });
					this.parentMethod(); // 更新数据驱动 => 父组件 shopPlan
					this.addDialogVisible = false;
				} else {
					this.$message.error(result.message)
				}
			}
			})
		},
		// 修改保存
		async editSubmit(){
			//触发验证表单
			this.$refs.addForm.validate(async(valid) => {
			if(valid){
			this.addForm.state = 2
			this.addForm.list = this.tableData
				if(this.tableData.length === 0){
					this.$message({type: 'error',message: '暂无对应的单据明细...' });
				}else{
					console.log(this.addForm);
					let result = await editPurchase(this.addForm)
					if (result.code === 200) {
					this.$message({ type: 'success', message: '修改成功！' });
					this.parentMethod(); // 更新数据驱动 => 父组件 shopPlan
					this.addDialogVisible = false;
					} else {
					this.$message.error(res.message)
					}
				}
			}
			})
		},
		// 修改草稿保存
		async draftEditSubmit(){
			//触发验证表单
			this.$refs.addForm.validate(async(valid) => {
			if(valid){
			this.addForm.state = 0
			this.addForm.list = this.tableData
			console.log(this.addForm);
			let result = await editPurchase(this.addForm)
				if (result.code === 200) {
					this.$message({ type: 'success', message: '采购计划草稿：已修改！！' });
					this.parentMethod(); // 更新数据驱动 => 父组件 shopPlan
					this.addDialogVisible = false;
				} else {
					this.$message.error(result.message)
				}
			}
			})
		},
		// 查看单据数据
		watchData(){
			this.$message({type: 'waring',message: '正在开发中...' });
		},
		// 日期选择
		dateChoose(i){
			console.log(i);
			switch(i){
				// 生产日期
				case 14:
					this.pickerOptions = this.manuDatePickerOptions
				break;
				// 有效日期
				case 15:
					this.pickerOptions = this.expyDatePickerOptions
				break;
			}
		},
		// 生产厂家搜索框空白格处理
		removeAllSpaces(str) {
		  return str.trim().replace(/\s+/g, '');
		},
		// SelectVal to editForm
		handleChange(val){
			switch(this.idx){
				case 2:
					let rs = this.gysOption.find(name => name.id === val)
					this.addMainForm.supplierName = rs.supplierName
				break;
			}
		},
		// 父组件控制打开新增模态框
		async open(param){
			if(param == '新增'){
				this.addDialogVisible = true;
				this.isShow = true
				this.isEditShow = false;
				this.dialogTitle = '新增西药库零售调价单'
			}else{
				this.addDialogVisible = true;
				this.isEditShow = true;
				this.dialogTitle = '编辑西药库零售调价单'
				let res = await getDrugDetails({ id:param.id });
				if(res.code === 200){
					// console.log(res.data);
					// 遍历 res.data 的所有键名
					for (let key in res.data) {
					  // 检查键名是否在对象 A 中存在
					  if (this.addForm.hasOwnProperty(key)) {
						// 如果存在，将 B 中的值更新到 A 中
						this.addForm[key] = res.data[key];
					  }
					}
					// this.addForm.markUpId == 2 ? this.addForm.markUpFixed = 1 : this.addForm.markUpFixed = 0
					this.tableData = this.addForm.list
					this.addForm.id = param.id
				}
			}
		},
		// 根据选择的id去查找id对应的对象
		foundObj(){
			let rs = this.gysOption.find(name => name.id === val)
			console.log(rs);
		},
		deleteRow(index, rows) {
		  rows.splice(index, 1);
		},
		handleSelectCost(val) {
		  this.addForm.nativePlace = val.join(',')
		},
		// db events
		// 给单元格绑定横向和竖向的index，这样就能确定是哪一个单元格
		tableCellClassName({row, column, rowIndex, columnIndex}){
			row.index = rowIndex;
			column.index = columnIndex;
		},
		// 当input失去焦点的时候，隐藏input
		hideInput(){
		    this.currentCell = null;
		},
		// db events
		handledbRow(row, column, event){
			if(row){ this.addForm = row; this.watchDialogVisible = true } else { console.log('fail'); }
			// console.log(this.addForm);
			this.formdisabled = true
		},
		// col 里面包含了表头字段和名称，list 是表格数据
		columnWidth(col, list) {
		  let prop = col.prop,lab = col.lab;
		  let width = 40; // 设定一个最小值
		  let maxlenStr = ""; // 最长字符串
		  for (let info of list) { if (maxlenStr < (info[prop] + "").length) maxlenStr = info[prop] }
		  width = Math.max(width, len(lab), len(maxlenStr));
		  // 表格自带的内边距(20px) 自调
		  return width + 24; // 这里加了 12px
		  function len(str) {
			// 实际分配长度可根据需要自行调整
			let length = 12;
			for (const char of str + "") {
			  // 英文小写字符 8px
			  if ("a" <= char && char <= "z") length += 8;
			  // 英文大写字符 8px
			  else if ("A" <= char && char <= "Z") length += 8;
			  // 中文字符 28px
			  else if (char >= "\u4e00" && char <= "\u9fa5") length += 28;
			  // 其他 8px
			  else length += 12;
			}
			return length;
		  }
		},
		// 内层
		innerColumnWidth(col, list){
			let prop = col.prop,lab = col.lab;
			let width = 28; // 设定一个最小值
			let maxlenStr = ""; // 最长字符串
			for (let info of list) { if (maxlenStr < (info[prop] + "").length) maxlenStr = info[prop] }
			width = Math.max(width, len(lab), len(maxlenStr));
			// 表格自带的内边距(20px) 自调
			return width + 24; // 这里加了 12px
			function len(str) {
				// 实际分配长度可根据需要自行调整
				let length = 12;
				for (const char of str + "") {
				  // 英文小写字符 8px
				  if ("a" <= char && char <= "z") length += 8;
				  // 英文大写字符 8px
				  else if ("A" <= char && char <= "Z") length += 8;
				  // 中文字符 22px
				  else if (char >= "\u4e00" && char <= "\u9fa5") length += 22;
				  // 其他 8px
				  else length += 12;
				}
				return length;
			}
		},
		// 挂载或销毁前后重新赋值后端参数
		getAddForm(){
			// 左侧提交表单
			this.addForm = addForm.map(v => {return v })[0]; // Form
			this.addMainForm = this.addForm.list[0]
			// 定义数据来源
			this.formType = AccType.map(function(val) { return val })
			this.formMainType = AccMainType.map(function(val) { return val })
			// 解构赋值排除 list 属性 => 弃用
			// this.addHeadrForm = addForm.map(item => { let { list, ...newItem } = item; return newItem })[0];
		},
		//分页
		//每页条数改变触发
		handleSizeChange(val) {
			this.pageNum = val;
			this.loadData();
		},
		//当前条数改变触发
		handleCurrentChange(val) {
			this.pageNum = val;
			this.loadData();
		},
		// 关闭最小化未保存清空的表单
		minimizeDialog() {
			this.addDialogVisible = false;
			this.isMinimized = true;
		},
		// 打开最小化未保存清空的表单
		restoreDialog() {
			this.addDialogVisible = true;
			this.isMinimized = false;
		},
		// 关闭
		handleClose(done) {
			this.$confirm('关闭此界面会清空现已选择的内容, 是否继续?', '提示', {
			  confirmButtonText: '确定',
			  cancelButtonText: '取消',
			  type: 'warning'
			}).then(() => {
				//清空表单和list
				this.$refs['addForm'].resetFields();
				this.$refs['addMainForm'].resetFields();
				this.tableData = [];
				done();
			}).catch(() => {
			  this.$message({ type: 'info', message: '已取消' });          
			});
		},
	},
	
}
</script>

<style lang="less" scoped>

.layout-app{
	
    width: 100%;
    height: 100%;
    display: flex;
	background-color: f8f8f8;
	/* 对话框样式 */
	.minimizable-dialog {
	  transition: all 0.3s;
	  transform: rotate(180deg);
	}
	.minimized-button {
	  transform: scale(1.1);
	  cursor: pointer;
	}
	.minimized-button {
	  position: fixed;
	  right: 20px;
	  bottom: 50%;
	  width: 40px;
	  height: 40px;
	  border-radius: 50%;
	  background-color: #409eff;
	  color: white;
	  display: flex;
	  justify-content: center;
	  align-items: center;
	  cursor: pointer;
	  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	  z-index: 9999;
	  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	  animation: floatIn 0.3s;
	}
	@keyframes floatIn {
	  from {
	    transform: scale(0) translateY(100%);
	    opacity: 0;
	  }
	  to {
	    transform: scale(1) translateY(0);
	    opacity: 1;
	  }
	}
    .addAcc{
		// self
		/deep/ .el-dialog__header{
			padding: 4px;
			background-color: #007bb0;
		}
		/deep/ .el-dialog__title{
			color: #fff;
			font-size: 12px;
		}
		/deep/ .el-dialog__headerbtn{
			top: 10px;
		}
		/deep/ .el-dialog__body{
			padding: 10px;
		}
		/deep/ .el-dialog__headerbtn .el-dialog__close{
			color: #fff;
		}
		/deep/ .el-dialog__headerbtn .el-dialog__close:hover{
			background-color: brown;
		}
		/deep/ .el-table .cell{
			font-size: 12px;
			font-weight: 400;
			color: #0c0c0c;
			text-align: center;
		}
		/* 自定义高亮颜色 */
		::v-deep .el-table__body tr.current-row > td {
		  background-color: #00557f !important;
		  color: #f9f9f9; /* 可选：修改文字颜色 */
		}
		/deep/ .el-table .el-table__cell{
			padding: 8px 0;
		}
		// 选项卡
		.tabs{
			
			.tabsMain{
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				align-items: center;
				width: 100%;
				.table{
					width: 100%;
					margin-top: 12px;
				}
				.total{
					display: flex;
					height: 48px;
					align-items: center;
					span{
						font-size: 12px;
					}
				}
				// 第一层头部表单
				.headerForm{
					/deep/ .el-input{
						width: 100%;
					}
					/deep/ .el-select >.el-input{
						width: 100%;
					}
					border: 1px solid #EBEEF5;
					padding: 8px;
					/deep/ .el-form-item__label{
						display: flex;
						justify-content: start;
						font-size: 12px;
						padding: 0;
					}
					/deep/ .el-input--mini .el-input__inner{
						height: 26px;
					}
				}
				// 第二层主体表单
				.mainForm{
					/deep/ .el-date-editor.el-input, .el-date-editor.el-input__inner{
						width: 100%;
					}
					/deep/ .el-form-item__label{
						display: flex;
						justify-content: center;
						font-size: 10px;
						padding: 0;
					}
					/deep/ .el-input--mini .el-input__inner{
						height: 26px;
					}
					padding: 8px;
					margin-top: 8px;
					border: 1px solid #EBEEF5;
					/deep/ .el-select-dropdown__item{
						border: 1px solid #eeeeee;
						padding: 0;
						height: 28px;
						#optionItem {
							width: 100%;
							height: 100%;
							display: flex;
							align-items: center;
							text-align: center;
							justify-content: center;
							span{
								display: inline-block;
								font-size: 12px;
								width: 168px;
								height: 40px;
								line-height: 40px;
								white-space: nowrap;      /* 禁止换行 */
								overflow: hidden;         /* 隐藏溢出内容 */
								text-overflow: ellipsis;  /* 溢出显示省略号 */
							}
						}
					}
				}
			}	
		}
		.dialog-footer{
			display: flex;
			justify-content: right;
		}
	}
	.innerModel{
		/deep/ .el-dialog__header{
				padding: 4px;
				line-height: 28px;
				background-color: #007bb0;
			}
			/deep/ .el-dialog__title{
				color: #fff;
				font-size: 12px;
			}
			/deep/ .el-dialog__headerbtn .el-dialog__close{
				color: #fff;
			}
			/deep/ .el-dialog__headerbtn .el-dialog__close:hover{
				background-color: brown;
			}
			/deep/ .el-table .cell{
				font-size: 12px;
				font-weight: 400;
				color: #0c0c0c;
				text-align: center;
			}
			/* 自定义高亮颜色 */
			::v-deep .el-table__body tr.current-row > td {
			  background-color: #00557f !important;
			  color: #f9f9f9; /* 可选：修改文字颜色 */
			}
			/deep/ .el-table .el-table__cell{
				padding: 8px 0;
			}
		.innerModel-header{
			display: flex;
			align-items: center;
		}
		.innerModel-table{
			/* 自定义高亮颜色 */
			::v-deep .el-table__body tr.current-row > td {
			  background-color: #00557f !important;
			  color: #f9f9f9; /* 可选：修改文字颜色 */
			}
		}
	}
	
}
</style>